const routers = [
    {
        path: '/platform',
        redirect: '/platform/detail',
        name: 'platform',
        meta: { title: '平台管理', icon: 'el-icon-s-help' },
        role: 'all',
        children: [
          {
            path: 'list',
            name: 'list',
            role: 'admin',
            meta: { title: '平台信息', icon: 'form' }
          },
          {
            path: 'detail',
            name: 'detail',
            role: 'all',
            meta: { title: '平台详情', icon: 'form' }
          }
        ]
      }
]

const role = 'admin1'
const filteredRoutes = routers.filter(route => {
    if (route.role === 'all') {
      return true; // 所有角色都可见
    } else if (route.role === 'admin' && role === 'admin') {
      return true; // 只有管理员角色可见
    }
    return false; // 其他角色不可见
  });
console.log(filteredRoutes)